'\" te
.\"  Copyright 1989 AT&T  Copyright (c) 1997 Sun Microsystems, Inc.  All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH DEVRESERV 8 "Jul 5, 1990"
.SH NAME
devreserv \- reserve devices for exclusive use
.SH SYNOPSIS
.LP
.nf
\fBdevreserv\fR [\fIkey\fR [\fIdevice-list\fR]...]
.fi

.SH DESCRIPTION
.sp
.LP
\fBdevreserv\fR reserves devices for exclusive use. When the device is no
longer required, use  \fBdevfree\fR to release it.
.sp
.LP
\fBdevreserv\fR reserves at most one device per  \fIdevice-list\fR. Each list
is searched in linear order until the first available device is found. If a
device cannot be reserved from each list, the entire reservation fails.
.sp
.LP
When  \fBdevreserv\fR is invoked without arguments, it lists the devices that
are currently reserved and shows to which key it was reserved. When
\fBdevreserv\fR is invoked with only the  \fIkey\fR argument, it lists the
devices that are currently reserved to that key.
.SH OPERANDS
.sp
.LP
The following operands are supported:
.sp
.ne 2
.na
\fB\fIdevice-list\fR\fR
.ad
.RS 15n
Defines a list of devices that \fBdevreserv\fR will search to find an available
device. The list must be formatted as a single argument to the shell.
.RE

.sp
.ne 2
.na
\fB\fIkey\fR\fR
.ad
.RS 15n
Designates a unique key on which the device will be reserved. The key must be a
positive integer.
.RE

.SH EXAMPLES
.LP
\fBExample 1 \fRReserving a Floppy Disk and a Cartridge Tape
.sp
.LP
The following example reserves a floppy disk and a cartridge tape:

.sp
.in +2
.nf
$ key=$$
$ echo "The current Process ID is equal to: $key"
  The Current Process ID is equal to: 10658
$ devreserv $key diskette1 ctape1
.fi
.in -2
.sp

.LP
\fBExample 2 \fRListing All Devices Currently Reserved
.sp
.LP
The following example lists all devices currently reserved:

.sp
.in +2
.nf
$ devreserv
  disk1         2423
  diskette1     10658
  ctape1        10658
.fi
.in -2
.sp

.LP
\fBExample 3 \fRListing All Devices Currently Reserved to a Particular Key
.sp
.LP
The following example lists all devices currently reserved to a particular key:

.sp
.in +2
.nf
$ devreserv $key
  diskette1
  ctape1
.fi
.in -2
.sp

.SH EXIT STATUS
.sp
.LP
The following exit values are returned:
.sp
.ne 2
.na
\fB\fB0\fR\fR
.ad
.RS 5n
Successful completion.
.RE

.sp
.ne 2
.na
\fB\fB1\fR\fR
.ad
.RS 5n
Command syntax was incorrect, an invalid was option used, or an internal error
occurred.
.RE

.sp
.ne 2
.na
\fB\fB2\fR\fR
.ad
.RS 5n
Device table or device reservation table could not be opened for reading.
.RE

.sp
.ne 2
.na
\fB\fB3\fR\fR
.ad
.RS 5n
Device reservation request could not be fulfilled.
.RE

.SH FILES
.sp
.ne 2
.na
\fB\fB/etc/device.tab\fR\fR
.ad
.RS 19n

.RE

.sp
.ne 2
.na
\fB\fB/etc/devlkfile\fR\fR
.ad
.RS 19n

.RE

.SH SEE ALSO
.sp
.LP
.BR attributes (7),
.BR devfree (8)
.SH NOTES
.sp
.LP
The commands \fBdevreserv\fR and \fBdevfree\fR are used to manage the
availability of devices on a system. Their use is  on a participatory basis and
they do not place any  constraints on the actual access to the device. They
serve as a centralized bookkeeping point for those who wish to use them.
Devices which have been reserved  cannot be used by processes which utilize the
device reservation functions until the reservation has been canceled. However,
processes that do not use device reservation may use a device that has been
reserved since such a process would not have checked for its reservation
status.
